
import 'package:flutter/material.dart';


import '../../entity/home/video_list_entity.dart';
import '../../entity/text_image/media_comment_entity.dart';
import '../../entity/text_image/text_image_entity.dart';
import '../../network/base_entity.dart';
import '../../network/http_manager.dart';
import '../../ui/widget/custom_refresh_mixin.dart';
import '../../utils/navigator_util.dart';

class MediaCommentModel extends ChangeNotifier with CustomRefreshMixin {
   int id;
  TextEditingController controller = TextEditingController();

  MediaCommentModel({required this.id});

  @override
  Future<List> requestList(int page) async {
    List tempL = [];
    Map<String, dynamic> params = {};
    late MediaCommentEntityList imageTextEntity = MediaCommentEntityList(mediaCommentEntityList: []);
    params["pageSize"] = 10;
    params["pageNum"] = page;
    params["id"] = id;
    // HudUtil.show();
    IBaseEntity? result = await HttpManager.getInstance().request(url: "/video/comments/list",params: params);;
    // HudUtil.dismiss();

    if (result?.isSuccess() == true) {

        imageTextEntity = MediaCommentEntityList.fromJson(result?.getData(),result);

        hasNext = imageTextEntity.hasNext ?? false;



    } else {
      // HudUtil.toast(result?.getMsg() ?? "");
    }

    return imageTextEntity.mediaCommentEntityList;
  }

  @override
  void onRequestComplete() {
    notifyListeners();
  }


  void follow(BuildContext context) {
    debugPrint("follow-------");
  }


  void forward(BuildContext context, VideoEntity entity) {
    debugPrint("forward-------");
    // ShareToWxDelegate.getInstance().showSharePop(context, onTapFriend: () {
    //   ShareToWxDelegate.getInstance().doShareVideo(entity.videoUrl ?? "", true, entity.title ?? "");
    // }, onTapCircle: () async {
    //   ShareToWxDelegate.getInstance().doShareVideo(entity.videoUrl ?? "", false, entity.title ?? "");
    // });

  }
}